package com.yidu.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.yidu.comment.Tools;
import com.yidu.dao.SnComTypeMapper;
import com.yidu.model.SnComType;
import com.yidu.service.SnComTypeService;
/**
 * 商品类型实现类
 * @author chensituo
 * @date 2018年11月27日 下午11:31:46
 */
@Service
public class SnComTypeServiceImpl implements SnComTypeService{
	/**
	 * 注入商品类型mapper
	 */
	@Resource
	SnComTypeMapper comTypeMapper;


	@Override
	public int delete(String typeId) {
		return comTypeMapper.delete(typeId);
	}

	@Override
	public int addOrUpdate(SnComType comType) {
		comType.setOptime(Tools.getCurDateTime());
		int row = 0;
		if(comType.getTypeId() != null && !"".equals(comType.getTypeId())){
			row = comTypeMapper.updateByPrimaryKeySelective(comType);
		}else{
			row = comTypeMapper.insertSelective(comType);
		}
		return row;
	}

	@Override
	public SnComType findById(String typeId) {
		SnComType type = comTypeMapper.findById(typeId);		
		return type;
	}


	@Override
	public List<SnComType> queryAll(Map<String, Object> map) {
		return comTypeMapper.queryAll(map);
	}

	@Override
	public int findCount(Map<String, Object> map) {
		return comTypeMapper.findCount(map);
	}


	@Override
	public SnComType selectByPrimaryKey(String typeId) {
		return comTypeMapper.selectByPrimaryKey(typeId);
	}

	@Override
	public int updateByPrimaryKeySelective(SnComType comType) {
		return comTypeMapper.updateByPrimaryKeySelective(comType);
	}

	@Override
	public List<SnComType> query() {
		return comTypeMapper.query();
	}

}
